{{extend 'layout.html'}}

{{if welcome_package:}}
    <h3>Welcome to pyforum.</h3>
    <p>It appears that this is the first time that you are accessing the pyforum installation.</p>
    <p>For your convenience, a Forum Administrator user has been created, please take note of the
    following information:</p>
    <p>Username: <b>{{=welcome_package['new_user']}}</b><br />
    Password: <b>{{=welcome_package['new_user_passwd']}}</b></p>
    <p>Please do not refresh this page until you have written this password in a secure place,
    alternatively, you are strongly encouraged to change your password by clicking on the link below.
    For your convenience, the system has automatically logged you in.</p>
    <p><a href="{{=URL(r=request, c='default', f='user', args=['change_password'])}}"
    title="Change Your Password"
    class="linkb">Click here to change your password</a>.</p>
    <p><strong style="color:red;">Warning: This message will not be shown again.</strong></p>
{{else:}}

    {{if master_content['system_announcement']:}}
        <h3>{{=master_content['system_announcement'].title}}</h3>
        <div class="paragraph">{{=XML(master_content['system_announcement'].contents)}}</div>
        <div class="paragraph"><a href="{{=URL(r=request, c='default', f='topic', args=[master_content['system_announcement'].id])}}" title="">Read More..</a></div>
    {{pass}}

    {{if master_content['categories']:}}
        {{for cat_id in master_content['categories']:}}
            <table class="bordered" style="width:100%;">
                <thead>
                    <tr>
                        <th style="text-align: left;width: 60%;">
                            <div>{{=master_content['categories_info'][cat_id]['category_info']['cat_name']}}</div>
                            <div class="sub-cat">{{=master_content['categories_info'][cat_id]['category_info']['cat_desc']}}</div>
                        </th>
                        <th>Posts</th>
                        <th>Replies</th>
                        <th>Views</th>
                        <th>Last Updated</th>
                    </tr>
                </thead>
                <tbody>
                    {{if master_content['categories_info'][cat_id]['forums_list']:}}
                        {{for forum_data in master_content['categories_info'][cat_id]['forums_list']:}}
                            <tr>
                                <td>
                                    <div><a href="{{=URL(r=request, c='default', f='forum', args=[forum_data['id']])}}" class="linkb">{{=forum_data['forum_title']}}</a></div>
                                    <div class="sub-cat"><a class="small" href="{{=URL(r=request, c='default', f='forum', args=[forum_data['id']])}}">{{=forum_data['forum_desc']}}</a></div>
                                </td>
                                <td style="text-align: center;">{{=forum_data['posts']}}</td>
                                <td style="text-align: center;">{{=forum_data['replies']}}</td>
                                <td style="text-align: center;">{{=forum_data['views']}}</td>
                                <td style="text-align: center;">{{=forum_data['modifying_date']}}</td>
                            </tr>
                        {{pass}}
                    {{else:}}
                        <tr><td colspan="5"><i>No forums found in this category.</i></td></tr>
                    {{pass}}
                </tbody>

            </table>
        {{pass}}
    {{else:}}
        <h2 class="fancy">No available categories were found.</h2>
    {{pass}}
{{pass}}
